package com.five.api.controller;

import com.five.controller.BaseController;
import com.five.api.service.ChapterService;
import com.five.entity.Orders;
import com.five.vo.BaseResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: star
 * @Date: 2021-05-21 14:06
 */
@Controller
@RequestMapping("chapter")
@CrossOrigin
@Api("课程章节业务接口")
public class ChapterController extends BaseController {

    @Autowired
    private ChapterService chapterService;

    @ResponseBody
    @RequestMapping(value = "updateViewCount", method = RequestMethod.POST)
    @ApiOperation(value = "更新观看量接口")
    public BaseResultVO<Orders> updateViewCount(@ApiParam("章节id") @RequestParam("id") Long id){
        chapterService.updateViewCount(id);
        return successRespWithMessage("观看量更新成功");
    }
}
